//
//  BrandUtils.m
//  CarTown
//
//  Created by xionghao on 15/9/10.
//  Copyright (c) 2015年 熊浩. All rights reserved.
//

#import "BrandUtils.h"

@implementation BrandUtils
+(void)getBrand:(void (^)(bool))su{
   NSArray *sets= [Brand getBrand];
    if (sets.count>0) {
        if (su) {
            su(YES);
        }
        return;
    }
    
    NSMutableDictionary *params=[NSMutableDictionary dictionary];
    params[@"action"]=@"all";
    [PostUitls Post:carlisturl parameters:params success:^(id response) {
        NSDictionary *dict=response;
        NSArray *data=dict[@"data"];
        [Brand addBrand:data];
        
        if (su) {
            su(YES);
        }
        
    } failure:^(NSError *error) {
        NSLog(@"%@",error);
        
        if (su) {
            su(NO);
        }
    }];

}
@end
